<?php
class TimeLinesController extends AppController
{
    public function index()
    {
    }
    
    public function view($id = null)
    {
        return $this->TimeLine->findById($id);
    }
    
    public function last()
    {
        return $this->TimeLine->query("SELECT * FROM time_lines WHERE user_id = ".$this->Auth->user('id')." ORDER BY create_date DESC LIMIT 1");
    }
    
    public function create()
    {
        $data = array(
          'create_date' => date(DATE_ATOM,time()),
          'user_id' => $this->Auth->user('id'),
          );
        
        $this->TimeLine->save($data);
        
    }
    
    public function ultimoid()
    {
        return $this->TimeLine->getInsertId();
    }
    
    
}
?>
